<?php

namespace sil29\VitrineBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * User
 */
class User implements UserInterface, \Serializable 

{
	/**
	 *
	 * @var integer
	 */
	private $id;
	
	/**
	 *
	 * @var string
	 */
	private $nom;
	
	/**
	 *
	 * @var string
	 */
	private $prenom;
	
	/**
	 *
	 * @var string
	 */
	private $adresse;
	
	/**
	 *
	 * @var integer
	 */
	private $codePostal;
	
	/**
	 *
	 * @var string
	 */
	private $login;
	
	/**
	 *
	 * @var string
	 */
	private $motDePasse;
	
	/**
	 *
	 * @var string
	 */
	private $email;
	
	/**
	 * Get id
	 *
	 * @return integer
	 */
	public function getId() {
		return $this->id;
	}
	
	/**
	 * Set nom
	 *
	 * @param string $nom        	
	 * @return User
	 */
	public function setNom($nom) {
		$this->nom = $nom;
		
		return $this;
	}
	
	/**
	 * Get nom
	 *
	 * @return string
	 */
	public function getNom() {
		return $this->nom;
	}
	
	/**
	 * Set prenom
	 *
	 * @param string $prenom        	
	 * @return User
	 */
	public function setPrenom($prenom) {
		$this->prenom = $prenom;
		
		return $this;
	}
	
	/**
	 * Get prenom
	 *
	 * @return string
	 */
	public function getPrenom() {
		return $this->prenom;
	}
	
	/**
	 * Set adresse
	 *
	 * @param string $adresse        	
	 * @return User
	 */
	public function setAdresse($adresse) {
		$this->adresse = $adresse;
		
		return $this;
	}
	
	/**
	 * Get adresse
	 *
	 * @return string
	 */
	public function getAdresse() {
		return $this->adresse;
	}
	
	/**
	 * Set codePostal
	 *
	 * @param integer $codePostal        	
	 * @return User
	 */
	public function setCodePostal($codePostal) {
		$this->codePostal = $codePostal;
		
		return $this;
	}
	
	/**
	 * Get codePostal
	 *
	 * @return integer
	 */
	public function getCodePostal() {
		return $this->codePostal;
	}
	
	/**
	 * Set login
	 *
	 * @param string $login        	
	 * @return User
	 */
	public function setLogin($login) {
		$this->login = $login;
		
		return $this;
	}
	
	/**
	 * Get login
	 *
	 * @return string
	 */
	public function getLogin() {
		return $this->login;
	}
	
	/**
	 * Set motDePasse
	 *
	 * @param string $motDePasse        	
	 * @return User
	 */
	public function setMotDePasse($motDePasse) {
		$this->motDePasse = $motDePasse;
		
		return $this;
	}
	
	/**
	 * Get motDePasse
	 *
	 * @return string
	 */
	public function getMotDePasse() {
		return $this->motDePasse;
	}
	
	/**
	 * Set email
	 *
	 * @param string $email        	
	 * @return User
	 */
	public function setEmail($email) {
		$this->email = $email;
		
		return $this;
	}
	
	/**
	 * Get email
	 *
	 * @return string
	 */
	public function getEmail() {
		return $this->email;
	}
	/**
	 *
	 * @var string
	 */
	private $ville;
	
	/**
	 * Set ville
	 *
	 * @param string $ville        	
	 * @return User
	 */
	public function setVille($ville) {
		$this->ville = $ville;
		
		return $this;
	}
	
	/**
	 * Get ville
	 *
	 * @return string
	 */
	public function getVille() {
		return $this->ville;
	}
	/**
	 *
	 * @var \DateTime
	 */
	private $dateDeNaissance;
	
	/**
	 * Set dateDeNaissance
	 *
	 * @param \DateTime $dateDeNaissance        	
	 * @return User
	 */
	public function setDateDeNaissance($dateDeNaissance) {
		$this->dateDeNaissance = $dateDeNaissance;
		
		return $this;
	}
	
	/**
	 * Get dateDeNaissance
	 *
	 * @return \DateTime
	 */
	public function getDateDeNaissance() {
		return $this->dateDeNaissance;
	}
	/**
	 *
	 * @var \Doctrine\Common\Collections\Collection
	 */
	private $commandes;
	
	/**
	 * Constructor
	 */
	public function __construct() {
		$this->commandes = new \Doctrine\Common\Collections\ArrayCollection ();
	}
	
	/**
	 * Add commandes
	 *
	 * @param \sil29\VitrineBundle\Entity\Commande $commandes        	
	 * @return User
	 */
	public function addCommande(\sil29\VitrineBundle\Entity\Commande $commandes) {
		$this->commandes [] = $commandes;
		
		return $this;
	}
	
	/**
	 * Remove commandes
	 *
	 * @param \sil29\VitrineBundle\Entity\Commande $commandes        	
	 */
	public function removeCommande(\sil29\VitrineBundle\Entity\Commande $commandes) {
		$this->commandes->removeElement ( $commandes );
	}
	
	/**
	 * Get commandes
	 *
	 * @return \Doctrine\Common\Collections\Collection
	 */
	public function getCommandes() {
		return $this->commandes;
	}
	public function __toString() {
		return $this->id;
	}
	public function getUsername() {
		return $this->login;
	}
	public function getSalt() {
		return '';
	}
	public function getPassword() {
		return $this->motDePasse;
	}
	public function getRoles() {
		if ($this->isAdministrateur())
			return array (
					'ROLE_ADMIN' 
			);
		else
			return array (
					'ROLE_USER' 
			);
	}
	public function eraseCredentials() {
	}
	public function serialize() {
		return serialize (array ($this->id));
	}
	public function unserialize($serialized) 
	{
		list ($this->id) = unserialize ( $serialized );
	}
    /**
     * @var boolean
     */
    private $administrateur;


    /**
     * Set administrateur
     *
     * @param boolean $administrateur
     * @return User
     */
    public function setAdministrateur($administrateur)
    {
        $this->administrateur = $administrateur;

        return $this;
    }

    /**
     * Get administrateur
     *
     * @return boolean 
     */
    public function isAdministrateur()
    {
        return $this->administrateur;
    }
}
